47 FrameBaseWPtr frame_ptr_;
48 FeatureBasePtrList feature_list_;
49 SensorBaseWPtr sensor_ptr_;
51 static unsigned int capture_id_count_;
59 void setProblem(ProblemPtr _problem)
override final;
79 SensorBasePtr _sensor_ptr =
nullptr,
90 void remove(
bool viral_remove_parent_without_children =
false)
override;
103 virtual FactorBasePtr
emplaceDriftFactor(CaptureBasePtr _capture_origin,
char _key,
bool _apply_loss_function);
115 unsigned int id()
const override;
140 void setFrame(
const FrameBasePtr _frm_ptr);
153 bool hasFeature(
const FeatureBaseConstPtr& _feature)
const;
181 virtual void setSensor(
const SensorBasePtr sensor_ptr);
188 StateBlockConstPtr
getStateBlock(
const char& _key)
const override;
220 void unfix()
override;
226 void link(FrameBasePtr _frm_ptr);
234 template <
typename classType,
typename... T>
235 static std::shared_ptr<classType>
emplace(FrameBasePtr _frm_ptr, T&&... all);
250 std::ostream& stream,
251 std::string _tabs =
"")
const;
262 void print(
int depth,
266 std::ostream& stream = std::cout,
267 std::string _tabs =
"")
const;
276 virtual CheckLog localCheck(
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
286 bool check(
CheckLog& _log,
bool _verbose, std::ostream& _stream, std::string _tabs =
"")
const;
291 FeatureBasePtr addFeature(FeatureBasePtr _ft_ptr);
295 void removeFeature(FeatureBasePtr _ft_ptr);
321template <
typename classType,
typename... T>
324 std::shared_ptr<classType> cpt = std::make_shared<classType>(std::forward<T>(all)...);
325 cpt->emplacePriors();
367 if (frame_ptr_.expired())
370 return frame_ptr_.lock();
375 if (frame_ptr_.expired())
378 return frame_ptr_.lock();
381inline void CaptureBase::setFrame(
const FrameBasePtr _frm_ptr)
383 frame_ptr_ = _frm_ptr;
388 FeatureBaseConstPtrList list_const;
389 for (
auto&& obj_ptr : feature_list_) list_const.push_back(obj_ptr);
395 return feature_list_;
405 return sensor_ptr_.lock();
410 return sensor_ptr_.lock();
415 sensor_ptr_ = sensor_ptr;
420 assert(_ts.
ok() &&
"Setting an invalid timestamp to a capture!");
431 return std::static_pointer_cast<CaptureBase>(shared_from_this());
436 return std::static_pointer_cast<const CaptureBase>(shared_from_this());
Base class of captures: a sensor measurement taken at a time stamp, linked to a frame,...
Definition: capture_base.h:41
virtual void printHeader(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
Prints the information of this node (not of its children)
Definition: capture_base.cpp:268
bool process()
Processes the capture with its sensor (see SensorBase::process())
Definition: capture_base.cpp:151
StateBlockConstPtr getSensorO() const
Returns the sensor state block of key 'O' (see getStateBlock())
Definition: capture_base.h:340
unsigned int id() const override
Returns the id of the node, unique among the nodes of its category.
Definition: capture_base.h:360
TimeStamp time_stamp_
Time stamp.
Definition: capture_base.h:55
StateBlockConstPtr getSensorP() const
Returns the sensor state block of key 'P' (see getStateBlock())
Definition: capture_base.h:330
void fix() override
Fixes all the state blocks.
Definition: capture_base.cpp:227
void print(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
Prints this node and, depending on the depth, its children.
Definition: capture_base.cpp:296
FrameBaseConstPtr getFrame() const
Returns the frame the capture belongs to (nullptr if none)
Definition: capture_base.h:365
StateBlockConstPtr getStateBlock(const char &_key) const override
Returns the state block of a key: the sensor's one if it is a static sensor state,...
Definition: capture_base.cpp:201
FeatureBaseConstPtrList getFeatureList() const
Returns the features of the capture.
Definition: capture_base.h:386
unsigned int capture_id_
Capture id, unique among captures.
Definition: capture_base.h:54
CaptureBase(const std::string &_type, const TimeStamp &_ts, SensorBasePtr _sensor_ptr=nullptr, const TypeComposite &_state_types={}, const VectorComposite &_state_vectors={}, const PriorComposite &_state_priors={})
Constructor.
Definition: capture_base.cpp:29
SensorBaseConstPtr getSensor() const
Returns the sensor that produced the capture (nullptr if unknown)
Definition: capture_base.h:403
void setTimeStamp(const TimeStamp &_ts)
Sets the time stamp.
Definition: capture_base.h:418
bool hasChildren() const override
Returns whether the capture has children: features or factors constraining it.
Definition: capture_base.cpp:109
void setProblem(ProblemPtr _problem) override final
Sets the problem to the capture and its features, and updates the last capture of the sensor.
Definition: capture_base.cpp:252
FactorBaseConstPtrList getFactorList() const
Returns the factors of all the features of the capture.
Definition: capture_base.cpp:170
virtual FactorBasePtr emplaceDriftFactor(CaptureBasePtr _capture_origin, char _key, bool _apply_loss_function)
Emplaces a FactorBlockDifference with zero difference between the state _key of this capture and _cap...
Definition: capture_base.cpp:114
virtual void setSensor(const SensorBasePtr sensor_ptr)
Sets the sensor that produced the capture.
Definition: capture_base.h:413
void unfix() override
Unfixes all the state blocks.
Definition: capture_base.cpp:232
StateBlockConstPtr getSensorIntrinsic() const
Returns the sensor state block of key 'I' (see getStateBlock())
Definition: capture_base.h:350
virtual bool isMotion() const
Returns whether the capture is a motion capture (CaptureMotion)
Definition: capture_base.h:316
void link(FrameBasePtr _frm_ptr)
Links the capture to a frame.
Definition: capture_base.cpp:237
~CaptureBase() override=default
void remove(bool viral_remove_parent_without_children=false) override
Removes the capture, its features and their factors.
Definition: capture_base.cpp:73
bool check(CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node and its children, composing the log.
Definition: capture_base.cpp:378
CaptureBasePtr shared_from_this_capture()
Returns a shared pointer to this capture.
Definition: capture_base.h:429
void setTimeStampToNow()
Sets the time stamp to the current time.
Definition: capture_base.h:424
TimeStamp getTimeStamp() const
Returns the time stamp.
Definition: capture_base.h:398
bool hasFeature(const FeatureBaseConstPtr &_feature) const
Returns whether the feature belongs to the capture.
Definition: capture_base.cpp:196
virtual CheckLog localCheck(bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node (not of its children)
Definition: capture_base.cpp:309
static std::shared_ptr< classType > emplace(FrameBasePtr _frm_ptr, T &&... all)
Creates a capture of class classType, emplaces its priors and links it to the frame.
Definition: capture_base.h:322
Log of a consistency check: whether it is consistent and the explanation of the inconsistencies.
Definition: check_log.h:30
Base class of factors: a constraint between state blocks of one or more nodes, given a measurement an...
Definition: factor_base.h:73
Base class of features: a measurement with its uncertainty, extracted from a capture,...
Definition: feature_base.h:40
Base class of frames: the states of the robot at a time stamp, in the trajectory, with the captures t...
Definition: frame_base.h:40
Base class of the nodes having state blocks (sensors, frames, captures and landmarks)
Definition: node_state_blocks.h:36
TimeStamp implements basic functionalities for time stamps.
Definition: time_stamp.h:39
bool ok() const
Returns whether the time stamp has a valid value.
Definition: time_stamp.h:214
void setToNow()
Sets the time stamp to now (valid)
Definition: time_stamp.cpp:69
Composite of state vectors.
Definition: vector_composite.h:29
Definition: capture_base.h:23
Composite< Prior > PriorComposite
Definition: prior_composite.h:87